package ss12.ColorIdentifier;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Gallery.LayoutParams;
public class ColorTest extends Activity implements OnTouchListener{
	private LinearLayout mLinearLayout;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        HexToStringConverter htsc = new HexToStringConverter();
        String blue = htsc.getColorName(0x0101fe);
        String red = htsc.getColorName(0xfe0000);
        String black = htsc.getColorName(0x050505);
        String ok;
        Button button = (Button)findViewById(R.id.myButton);
        
        ImageView i = new ImageView(this);
        
        Bitmap bitmap = Bitmap.createBitmap(600, 300, Bitmap.Config.RGB_565);
        
        bitmap.setPixel(50, 50, 0x00FF00);
        bitmap.setPixel(100, 200, 0x0000FF);
        BitmapDrawable bmd = new BitmapDrawable(bitmap);
        
        i.setAdjustViewBounds(true); // set the ImageView bounds to match the Drawable's dimensions
        i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

        // Add the ImageView to the layout and set the layout as the content view
        mLinearLayout = new LinearLayout(this);
        mLinearLayout.addView(i);
        
        i.setOnTouchListener(this);

        i.setImageBitmap(bitmap);
        setContentView(mLinearLayout);
    }
    public boolean onTouch(View v, MotionEvent me){
    	float x = me.getX();
    	float y = me.getY();
    	return true;
    }
}